package com.asset.dispoal.nature.service.commom;

import com.asset.dispoal.nature.domain.db.entity.GbNature;
import com.asset.dispoal.nature.domain.db.mapper.GbNatureMapper;
import com.asset.dispoal.nature.dto.requset.GbNatureRequest;
import com.asset.dispoal.nature.service.converter.GbNatureConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tech.mhuang.pacebox.core.ddd.BaseCommand;
import tech.mhuang.pacebox.springboot.protocol.Result;

/**
 * @author qr
 * @date 2022/2/25$
 */
@Component
public class UpdateNatureCommand implements BaseCommand<GbNatureRequest, Result> {


    @Autowired
    GbNatureMapper natureMapper;


    @Override
    public Result execute(GbNatureRequest gbNatureRequest) {
        final GbNature gbNature = GbNatureConverter.INSTANCE.reqToDo(gbNatureRequest);
        natureMapper.update(gbNature);
        return Result.ok();
    }
}
